home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: April 1, 1997
- // Author: RS
- //
- // Description:
- // The projectCurvePreset() procedure executes project curve operation.
- //
- // Input Arguments:
- // None.
- //
- // Return Value:
- // None.
- //
-
- // currentView -q -c
- // gives the current camera.
- //
-
- proc string pieceTogetherCmd(
- int $doHistory,
- int $curvePartial,
- int $viewDir,
- float $tol )
- //
- // Description :
- // Put together a projectCurve Cmd.
- //
- {
- string $cmd = "projectCurve" ;
-
- // history.
- //
- $cmd = $cmd + " -ch " ;
- if( $doHistory == 1 ) $cmd = $cmd + "true" ;
- else $cmd = $cmd + "false" ;
-
- // curve range.
- //
- $cmd = $cmd + " -rn " ;
- if( $curvePartial == 1 ) $cmd = $cmd + "true" ;
- else $cmd = $cmd + "false" ;
-
- // projection direction
- //
- $cmd = $cmd + " -un " ;
- if( $viewDir == 1 ) {
- $cmd = $cmd + " true " ;
- } else {
- $cmd = $cmd + " false " ;
- }
-
- $cmd = $cmd + " -tol " + $tol ;
-
- return $cmd ;
- }
-
- global proc projectCurvePreset(
- int $doHistory,
- int $curvePartial,
- int $viewDir,
- float $tol )
- //
- // Description :
- // Proc to do a bevel
- //
- {
-
- //---------------------------------------------
- // Get the list of nurbs curves to be projected
- // from the select list.
- //---------------------------------------------
- //
- global int $gSelectNurbsCurvesBit;
- global int $gSelectIsoparmsBit;
- global int $gSelectCurvesOnSurfacesBit;
- global int $gSelectSurfaceEdgeBit;
- global int $gSelectNurbsSurfacesBit;
- global int $gSelectMeshEdge;
-
- string $curveList[] = `filterExpand -ex true -sm $gSelectNurbsCurvesBit -sm $gSelectIsoparmsBit -sm $gSelectMeshEdge -sm $gSelectCurvesOnSurfacesBit -sm $gSelectSurfaceEdgeBit`;
-
- string $srfList[] = `filterExpand -ex true -sm $gSelectNurbsSurfacesBit` ;
-
-
- // NOTE : We do the piecing together after the filters. Why ?
- // If the project direction is based on the view camera, because
- // of the way the current view direction is determined we want
- // to ensure the selection list is NOT lost.
- //
-
- //---------------------------------------
- // put together a projectCurve cmd.
- //---------------------------------------
- //
- string $cmd = pieceTogetherCmd( $doHistory,
- $curvePartial,
- $viewDir,
- $tol ) ;
-
- //----------------------------------------
- // place holders for 1 selection items.
- //----------------------------------------
- //
- int $nitems = 2 ;
- $cmd = appendToCmdPlaceHoldersForSelectionItems($cmd,$nitems) ;
-
-
- //--------------------------------------------
- // Valid # of items.
- //--------------------------------------------
- //
-
-
- int $curveCount = size($curveList) ;
- int $srfCount = size($srfList) ;
- if( $curveCount == 0 ) {
- error "Select at least one curve to project" ;
- } else if( $srfCount == 0 ) {
- error "Select at least one NURBS surface to project on to" ;
- } else {
-
- ////////////////////////////////////////////////////////////
- // n curves & m surfaces gives n*m project curve operations.
- ////////////////////////////////////////////////////////////
- //
- string $pair[2] ;
- string $projectResults[] ;
- int $i, $j ;
- for( $i = 0 ; $i < $curveCount ; $i++ ) {
- $pair[0] = $curveList[$i] ;
- for( $j = 0 ; $j < $srfCount ; $j++ ) {
- $pair[1] = $srfList[$j] ;
- string $results[] = executeCmdOnItems($cmd,$pair);
- $projectResults = stringArrayCatenate($projectResults, $results);
- } // for $j.
- } // for $i.
-
- int $resultCount = size($projectResults) ;
-
- if( $resultCount > 0 ) {
- string $selectString;
- $selectString = "select -r ";
-
- for( $i = 0 ; $i < $resultCount ; $i++ ) {
- $selectString += $projectResults[$i] ;
- $selectString += " ";
- }
-
- $selectString += ";" ;
- eval($selectString) ;
- }
- }
- }
-
-